package com.minimalist.common.entity.lindi.vo.priceconfig;

import cn.hutool.core.date.DatePattern;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.minimalist.common.utils.Add;
import com.minimalist.common.utils.Update;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;

import java.io.Serial;
import java.io.Serializable;
import java.sql.Timestamp;
import java.time.LocalDateTime;
import java.util.Objects;

/**
 * 林地指标交易平台_价格配置表 VO类。
 *
 * @author 11987
 * @since 2025-07-09
 */
@Schema(name = "林地指标交易平台_价格配置实体")
public class LindiPriceConfigVO implements Serializable {
    @Serial
    private static final long serialVersionUID = 1L;

    @NotNull(message = "价格配置ID不能为空", groups = {Update.class})
    @JsonSerialize(using = ToStringSerializer.class)
    @Schema(name = "priceConfigId", description = "价格配置ID", type = "string")
    private Long priceConfigId;

    @NotBlank(message = "价格名称不能为空", groups = {Add.class, Update.class})
    @Schema(name = "priceName", description = "价格名称", type = "string")
    private String priceName;

    @NotBlank(message = "价格类型不能为空", groups = {Add.class, Update.class})
    @Schema(name = "priceType", description = "价格类型", type = "string")
    private String priceType;

    @NotBlank(message = "单价不能为空", groups = {Add.class, Update.class})
    @Schema(name = "unitPrice", description = "单价(万元/亩)", type = "string")
    private String unitPrice;

    @NotNull(message = "生效日期不能为空", groups = {Add.class, Update.class})
    @Schema(name = "effectiveDate", description = "生效日期", type = "string")
    @JsonFormat(pattern = DatePattern.NORM_DATETIME_PATTERN)
    private Timestamp effectiveDate;

    @Schema(name = "expireDate", description = "失效日期", type = "string")
    @JsonFormat(pattern = DatePattern.NORM_DATETIME_PATTERN)
    private Timestamp expireDate;

    @Schema(name = "remark", description = "备注", type = "string")
    private String remark;

    @JsonSerialize(using = ToStringSerializer.class)
    @Schema(name = "createId", description = "创建人ID", type = "string")
    private Long createId;

    @JsonSerialize(using = ToStringSerializer.class)
    @Schema(name = "updateId", description = "更新人ID", type = "string")
    private Long updateId;

    @Schema(name = "createTime", description = "创建时间", type = "string")
    @JsonFormat(pattern = DatePattern.NORM_DATETIME_PATTERN)
    private LocalDateTime createTime;

    @Schema(name = "updateTime", description = "更新时间", type = "string")
    @JsonFormat(pattern = DatePattern.NORM_DATETIME_PATTERN)
    private LocalDateTime updateTime;

    public LindiPriceConfigVO() {
    }

    public Long getPriceConfigId() {
        return priceConfigId;
    }

    public void setPriceConfigId(Long priceConfigId) {
        this.priceConfigId = priceConfigId;
    }

    public String getPriceName() {
        return priceName;
    }

    public void setPriceName(String priceName) {
        this.priceName = priceName;
    }

    public String getPriceType() {
        return priceType;
    }

    public void setPriceType(String priceType) {
        this.priceType = priceType;
    }

    public String getUnitPrice() {
        return unitPrice;
    }

    public void setUnitPrice(String unitPrice) {
        this.unitPrice = unitPrice;
    }

    public Timestamp getEffectiveDate() {
        return effectiveDate;
    }

    public void setEffectiveDate(Timestamp effectiveDate) {
        this.effectiveDate = effectiveDate;
    }

    public Timestamp getExpireDate() {
        return expireDate;
    }

    public void setExpireDate(Timestamp expireDate) {
        this.expireDate = expireDate;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public Long getCreateId() {
        return createId;
    }

    public void setCreateId(Long createId) {
        this.createId = createId;
    }

    public Long getUpdateId() {
        return updateId;
    }

    public void setUpdateId(Long updateId) {
        this.updateId = updateId;
    }

    public LocalDateTime getCreateTime() {
        return createTime;
    }

    public void setCreateTime(LocalDateTime createTime) {
        this.createTime = createTime;
    }

    public LocalDateTime getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(LocalDateTime updateTime) {
        this.updateTime = updateTime;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        LindiPriceConfigVO that = (LindiPriceConfigVO) o;
        return Objects.equals(priceConfigId, that.priceConfigId) &&
               Objects.equals(priceName, that.priceName) &&
               Objects.equals(priceType, that.priceType) &&
               Objects.equals(unitPrice, that.unitPrice) &&
               Objects.equals(effectiveDate, that.effectiveDate) &&
               Objects.equals(expireDate, that.expireDate) &&
               Objects.equals(remark, that.remark) &&
               Objects.equals(createId, that.createId) &&
               Objects.equals(updateId, that.updateId) &&
               Objects.equals(createTime, that.createTime) &&
               Objects.equals(updateTime, that.updateTime);
    }

    @Override
    public int hashCode() {
        return Objects.hash(priceConfigId, priceName, priceType, unitPrice, effectiveDate, expireDate, remark, createId, updateId, createTime, updateTime);
    }
}